<%@ page import="com.lkj.model.User" %>
<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta http-equiv="Cache-Control" content="no-siteapp">
<link href="<%=request.getContextPath()%>/css/common.css" rel="stylesheet" />
<title>华纵科技</title>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/jquery-1.8.3.min.js"></script>
<script src="<%=request.getContextPath()%>/js/jquery.floatDiv.js"></script>
<script src="<%=request.getContextPath()%>/js/common.js"></script>
<script type="text/javascript" src="<%=request.getContextPath() %>/bootstrap/js/bootstrap.min.js"></script>
<script type="text/javascript" src="<%=request.getContextPath() %>/bootstrap/js/bootstrap-paginator.js"></script>
    <%
        User user = (User) request.getSession().getAttribute("user");
    %>
<script type="text/javascript">
var contextTemp;
var orderTemp;
var pageTemp;
$(function() {
    initPage("asc","",1);

	$("#btn_search").click(function(){
		var search = $("#search").val();
		if(search != ""){
			$("#form_search").submit();
		}else{
			alert("请输入账号查询！");
			$("#search").focus();
		}
	})
	$("#btn_page").click(function(){
		var search = $("#pageinp").val();
		if(search != ""){
			$("#pageform").submit();
		}else{
			alert("请输入跳转页码！");
			$("#pageinp").focus();
		}
	})
	
	/*蓝色弹框js开始*/
	$("#msg-box").floatdiv({top:"80px",left:"350px"});
	
	$("#msg-close").click(function(){
		$("#msg-box").css("display","none");
	})
	
	$(".msg-close1").click(function(){
		$("#msg-box").css("display","none");
	})
	$(".modi").click(function(){
		$("#msg-box").css("display","block");
	})
	/*蓝色弹框js结束*/
	
	
	/*灰色弹框js开始*/
	
	$("#msg-box-gay").floatdiv({top:"80px",left:"350px"});
	
	$("#msg-close-gay").click(function(){
		$("#msg-box-gay").css("display","none");
	})
	
	$(".jh").click(function(){
		$("#msg-box-gay").css("display","block");
	})
	/*灰色弹框js结束*/

    $(document).on("click",".adj,.ajd",function() {
        var th = $(this);
        //拒绝按钮
        if (th.hasClass("adj")) {
            var data = {};
            data["status"] = "3";
            data["id"] = th.parent().parent().attr("value");
            update(data);
        }

        //通过按钮
        if (th.hasClass("ajd")) {
            var data = {};
            data["status"] = "1";
            data["id"] = th.parent().parent().attr("value");
            update(data);
        }

    })
	
});

function update(data){
    $.post("<%=request.getContextPath()%>/server/updateUser",data,function(result){
        if(result == "1"){
            initPage(orderTemp,contextTemp,pageTemp);
        }
    },"json")
}

//初始化列表
function initPage(isOrder,context,currentPage){
    var element = $('#bp-element');
    element.html("");

    contextTemp = context;
    orderTemp = isOrder;
    pageTemp = currentPage;

    var data = {};
    data["isOrder"] = isOrder;
    data["context"] = context;
    data["currentPage"] = currentPage;
    data["status"] = "1";
    //列表展示
    $.post("<%=request.getContextPath()%>/server/getUsers",data,function(data){
        var tbody = "";
        var pageUtil = data.pageUtil;
        $.each(data.list,function(index,entry){
            tbody +=
                "<tr value='"+entry.id+"'>"+
                    "<td><font class='blue f14'>"+entry.username+"</font><br />"+entry.nickname+"</td>"+
                    "<td>"+re_u(entry.status)+"<i class='modi fl'></i></td>"+
                    "<td>"+entry.createtime+"</td>"+
                    "<td>200</td>"+
                    "<td>HD-01/1024MB</td>"+
                    "<td>1024KB</td>"+
                    "<td>"+ac_btn(entry.status)+"</td>"+
                "</tr>";
        })
        $("#accountList").html(tbody);

        //搜索框赋值 (context,isOrder)
        $("#pageinp").val(pageUtil.context);
        $("#total").text(pageUtil.totalnum);
        //分页-s

        options = {
            bootstrapMajorVersion:3, //对应的bootstrap版本
            currentPage: pageUtil.currentPage, //当前页数，这里是用的EL表达式，获取从后台传过来的值
            numberOfPages: pageUtil.pagesize, //每页页数
            totalPages: pageUtil.totalpage,//总页数，这里是用的EL表达式，获取从后台传过来的值
            shouldShowPage:true,//是否显示该按钮
            itemTexts: function (type, page, current) {//设置显示的样式，默认是箭头
                switch (type) {
                    case "first":
                        return "首页";
                    case "prev":
                        return "上一页";
                    case "next":
                        return "下一页";
                    case "last":
                        return "末页";
                    case "page":
                        return page;
                }
            },
            //点击事件
            onPageClicked: function (event, originalEvent, type, page) {
                initPage(isOrder,context,page);
            }
        };
        element.bootstrapPaginator(options);
        //分页-e

    },"json");
}

function re_u(value){
    if(value=="1"){
        return "<font class='f14 block fl'>正常</font>"
    }
    if(value=="3"){
        return "<font class='red f14 block fl'>冻结</font>";
    }
}

var ac_btn = function(val){
    if (val == "1"){
        return "<a href='#' class='adj'>冻结</a>";
    }
    if (val == "3"){
        return "<a href='#' class='ajd'>解冻</a>";
    }
}
</script>
</head>

<body>
<!-- 顶部开始 -->
<div class="container-s">
	<div class="logo">
    	<a href="./index.html"><img src="<%=request.getContextPath()%>/img/logo.png" /></a>
    </div>
    <div class="top_search">
    	<!-- <form id="form_search" action="#" method="post">
            <a id="btn_search"></a>
            <input type="text" name="search" id="search" placeholder="请输入账号搜索..." />
        </form> -->
    </div>
    
    
    <div class="top_manage">
    	<div class="top_m_d">
        
        
        
        <script type="text/javascript">
			$(document).ready(function(){
					
				jQuery.navlevel2 = function(level1,dytime) {
					
				  $(level1).mouseenter(function(){
					  varthis = $(this);
					  delytime=setTimeout(function(){
						varthis.find('div').slideDown();
					},dytime);
					
				  });
				  $(level1).mouseleave(function(){
					 clearTimeout(delytime);
					 $(this).find('div').slideUp();
				  });
				  
				};
			  jQuery.navlevel2("div.mainlevel",200);
			});
			</script>
			
        	<div  class="mainlevel">
            	<span class="top_m_a"><%=user.getUsername()%></span>
            	<div>
                    <a href="#"><%=user.getUsername()%></a>
                    <a href="#" onclick="logout()">退出</a>
                </div>
            
            </div>
        </div>
    </div>
    
    <a id="top_set"></a>
    
    <div class="top_bell">
    	<span >2</span>
    </div>
    
</div>
<!-- 顶部结束 -->
<!-- 中部开始 -->
<!-- 左侧菜单开始 -->
<div class="left-nav">
    <ul class="ul-nav">
        <li>
            <a href="#">
                <i class="i1"></i>
                <cite>用户管理</cite>
            </a>
        </li>
        <li>
            <a href="<%=request.getContextPath()%>/server/registerManger">
                <i></i>
                <cite>注册管理</cite>
            </a>
        </li>
        <li>
            <a href="<%=request.getContextPath()%>/server/accountManger">
                <i></i>
                <cite>账号管理</cite>
            </a>
        </li>
        <li>
            <a href="<%=request.getContextPath()%>/server/fileServerManger">
                <i class="i3"></i>
                <cite>文件服务器管理</cite>
            </a>
        </li>
        <li>
            <a href="<%=request.getContextPath()%>/server/videoManger">
                <i class="i2"></i>
                <cite>视频文件管理</cite>
            </a>
        </li>
      <%--   <li>
            <a href="<%=request.getContextPath()%>/client/videoList">
                <i ></i>
                <cite>视频列表</cite>
            </a>
        </li> --%>
       <%--  <li>
            <a href="<%=request.getContextPath()%>/client/videoList?order=desc">
                <i></i>
                <cite>最近视频</cite>
            </a>
        </li> --%>
        
        <li>
            <a href="<%=request.getContextPath()%>/server/statusManger">
                <i class="i4"></i>
                <cite>状态管理</cite>
            </a>
        </li>
        <li>
            <a href="<%=request.getContextPath()%>/server/sceneManger">
                <i class="i5"></i>
                <cite>场景维护</cite>
            </a>
        </li>
    
    </ul>
</div>
<!-- 左侧菜单结束 -->
<!-- 右侧主体开始 -->
<div class="page-content">
	<div class="page-content-d">
    	<div class="page-c-nav">
            <span>所有账号（&nbsp;<font id="total" style="font-size: 14px;font-weight: bold;" color="#5db8f1">0</font>&nbsp;）</span>
        </div>
        
        <div class="clear h25"></div>
        
        <div class="ss">
        	<form action="#" id="ssform" method="post" ><input id="ssinput" type="text"  placeholder="请输入账号搜索..." /><a id="ssbtn">搜索</a></form>
        </div><%--<span class="gjjs">高级检索</span>--%>
        <div class="clear"></div>
        
        <div class="bg-cf">
        <table class="layui-table">
            <thead id="accountList">
                <tr>
                    <th>企业名称/账号</th>
                    <th>状态</th>
                    <th>有效期至</th>
                    <th>最大用户数</th>
                    <th>服务器编号/大小</th>
                    <th>单文件大小</th>
                    <th>操作</th>
                </tr>
            </thead>
            <tbody>
               <%-- <tr>
                    <td><font class="blue f14">中国铁路总公司</font><br />
CHINA RAILWAY(CR)</td>
                    <td><font class="red f14 block fl">冻结</font><i class="modi fl"></i></td>
                    <td>2017-01-01</td>
                    <td>200</td>
                    <td>HD-01/1024MB</td>
                    <td>1024KB</td>
                    <td><a href="#" class="ajd">解冻</a></td>
                </tr>
                
                
                <tr>
                    <td><font class="blue f14">中国铁路总公司</font><br />
CHINA RAILWAY(CR)</td>
                    <td><font class="f14 block fl">待激活</font><i class="jh fl"></i></td>
                    <td>2017-01-01</td>
                    <td>200</td>
                    <td>HD-01/1024MB</td>
                    <td>1024KB</td>
                    <td><a href="#" class="ajh">激活</a></td>
                </tr>
                
                <tr>
                    <td><font class="blue f14">中国铁路总公司</font><br />
CHINA RAILWAY(CR)</td>
                    <td>正常</td>
                    <td>2017-01-01</td>
                    <td>200</td>
                    <td>HD-01/1024MB</td>
                    <td>1024KB</td>
                    <td><a href="#" class="adj">冻结</a></td>
                </tr>--%>
                

            </tbody>
        </table>
        
        <div class="clear h25"></div>
        <%--<div class="page">
            <table border="0" align="center" cellpadding="0" class="page1">
                <tbody><tr><td>
                    <ul>
                        
                        <li><a class="avrp"><font></font></a></li> 
                        <li class="pagered"><a>1</a></li>
                        <li ><a>2</a></li>
                        <li><a>3</a></li>
                        <li><a>4</a></li>
                        <li><a class="nextpa"><font class="f14 block fl">下一页</font><i class="nextP fl"></i></a></li>
                        <div class="pagef"><form id="pageform" method="post"><span>到</span><input type="text" id="pageinp" name="page"/><span>页</span><a id="btn_page">确定</a></form></div>
                    </ul>
                </td></tr></tbody>
            </table>
        </div>--%>
        <center><ul id='bp-element'></ul></center>
        <div class="clear h25"></div>
        </div>
        
    </div>
	
</div>
<!-- 右侧主体结束 -->
<!-- 中部结束 -->

<!--蓝色弹出窗口开始-->
<div id="msg-box"  class="msg-box w400">
	<div class="msg-body">
    	<div class="msg-title">智能分析</div>
        <div class="msg-close" id="msg-close"></div>
    </div>
    <div class="msg-cont">
    	
        <div class="h25"></div>
        <div class="tk">名称：</div>
        <div class="tk1"><input type="text" name="mc" class="tkinp"/></div>
        <div class="h25 clear"></div>
         <div class="tk">名称：</div>
        <div class="tk1"><input type="text" name="mc" class="tkinp"/></div>
        <div class="h25 clear"></div>
         <div class="tk">名称：</div>
        <div class="tk1"><input type="text" name="mc" class="tkinp"/></div>
        <div class="h25 clear"></div>
         <div class="tk">名称：</div>
        <div class="tk1"><input type="text" name="mc" class="tkinp"/></div>
        <div class="h25 clear"></div>
        <div class="msg-close1">关闭</div>
    </div>
</div>
<!--结束-->


<!--灰色弹出窗口开始-->
<div id="msg-box-gay"  class="msg-box w400">
	<div class="msg-body-gay">
    	<div class="msg-title-gay">智能分析</div>
        <div class="msg-close-gay" id="msg-close-gay"></div>
    </div>
    <div class="msg-cont">
    	
        <div class="h25"></div>
        <div class="tk">名称：</div>
        <div class="tk1"><input type="text" name="mc" class="tkinp"/></div>
        <div class="h25 clear"></div>
         <div class="tk">名称：</div>
        <div class="tk1"><input type="text" name="mc" class="tkinp"/></div>
        <div class="h25 clear"></div>
         <div class="tk">名称：</div>
        <div class="tk1"><input type="text" name="mc" class="tkinp"/></div>
        <div class="h25 clear"></div>
         <div class="tk">名称：</div>
        <div class="tk1"><input type="text" name="mc" class="tkinp"/></div>
        <div class="h25 clear"></div>
        <div class="msg-close1">关闭</div>
    </div>
</div>
<!--结束-->

</body>
</html>
